package com.example.ui.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 董建业  时间:2017/4/9.
 */

public abstract class Basefragment extends Fragment {
    Unbinder unbinder;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(getlayoutid(), container, false);
        unbinder = ButterKnife.bind(this, rootView);

        initview(rootView);
        requestdata();
        viewbehavior();
        return rootView;
    }

    public abstract int getlayoutid();

    protected abstract void initview(View view);

    protected abstract void requestdata();

    protected abstract void viewbehavior();

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

}
